package com.x.client.adapter

import android.support.v4.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.gg.image.config.GlideApp
import com.gg.utils.isNullOrZero
import com.x.client.R
import com.x.client.bean.Series

/**
 * Creator : GG
 * Time    : 2017/11/18
 * Mail    : gg.jin.yu@gmail.com
 * Explain :
 */
class SeriesAdapter(data: ArrayList<Series> = arrayListOf()) : BaseQuickAdapter<Series, BaseViewHolder>(R.layout.item_brand, data) {


    override fun convert(helper: BaseViewHolder, item: Series) {
        helper.setText(R.id.name, item.seriesName)
                .setGone(R.id.logo, false)
                .setGone(R.id.noLogo, !item.logo.isNullOrZero())
        if (!item.logo.isNullOrZero()) {
            helper.setImageResource(R.id.noLogo, item.logo!!)
        }

        if (item.choose) {
            helper.setTextColor(R.id.name, ContextCompat.getColor(mContext, R.color.text_orange))
            helper.setVisible(R.id.check_mark, true)
        } else {
            helper.setTextColor(R.id.name, ContextCompat.getColor(mContext, R.color.text_black))
            helper.setVisible(R.id.check_mark, false)
        }
    }
}